
         <include file="Index/header" />
        <!--sidebar left start-->
        <include file="Index/nav" />
        <!--左侧栏 end-->
        <!--主内容 start-->
        <section class="main-content-wrapper">
            <section id="main-content">
                <!--tiles start-->
                <div class="row">
                    <div class="col-md-12">
                        <!--breadcrumbs start -->
                        <ul class="breadcrumb">
                            <li><a href="/admin.php"><i class="fa fa-dashboard"></i>后台管理</a>
                            </li>
                            <li>推送系统</li>
                            <li class="active">推送消息</li>
                        </ul>
                        <!--breadcrumbs end -->
                        
                    </div>
                </div>
                <!--tiles end-->
                
                <!--表格区-->
                <div class="row">
                    <div class="col-md-12">
                        <div class="panel panel-default">
                            <div class="panel-heading">
                                <h3 class="panel-title">推送消息</h3>
                                <div class="actions pull-right">
                                    <i class="fa fa-chevron-down"></i>
                                    <i class="fa fa-times"></i>
                                </div>
                            </div>
                            <div class="panel-body"> 
                            	
								  
								    	<form class="form-horizontal form-border" method="get">
								    		
								    		<div class="form-group">
		                                        <label class="col-sm-3 control-label">消息标题</label>
		                                        <div class="col-sm-6">
		                                            <input type="text" id="title" value="" name="title" class="form-control" placeholder="消息标题">
		                                        </div>
		                                    </div>
		                                    <div class="form-group">
		                                        <label class="col-sm-3 control-label">消息内容</label>
		                                        <div class="col-sm-6">
		                                            <input type="text" id="msg" value="" name="msg" class="form-control" placeholder="消息内容">
		                                        </div>
		                                    </div>
		                                    
		                                    <div class="form-group">
		                                    	<label class="col-sm-3 control-label">离线消息保留时长</label>
		                                    	<div class="col-sm-6">
				                                    <select id="time_to_live" class="form-control" name="time_to_live">
				                                        <option value="86400" selected="selected">默认一天</option>
				                                        <option value="3600">一小时</option>
				                                        <option value="7200">两小时</option>
				                                        <option value="10800">三小时</option>
				                                        <option value="43200">半天</option>
				                                        <option value="172800">两天</option>
				                                        <option value="259200">三天</option>
				                                    </select>
			                                    </div>
		                                	</div>
		                                	
		                                	<div class="form-group">
		                                    	<label class="col-sm-3 control-label">推送对象</label>
		                                    	<div class="col-sm-6">
				                                    <select id="pushto" class="form-control" name="pushto">
				                                        <option value="all">请选择---推送对象--默认all</option>
				                                        <option value="ios">苹果</option>
				                                        <option value="android">安卓</option>
				                                    </select>
			                                    </div>
		                                	</div>
		                                    
		                                    <div class="form-group">
		                                        <label class="col-sm-3 control-label"></label>
		                                        <div class="col-sm-6">
			                                        <button type="button" onclick="pushmsg()"  class="btn btn-primary">推送</button>
		                                        </div>
		                                    </div>
										   
			                            	<!--<button id="cs_push_btn"  type="button" class="btn btn-primary"><i class="fa fa-plus-circle"></i>推送</button>-->	
								    	</form>
								  
								  
								  <!--<div class="col-lg-6">
								  </div>	-->
								

                            	
                            </div>
                        </div>
                    </div>
                </div>
              
                
            </section>
        </section>
        <!--主内容区 end-->
        <!--右侧工具栏 start-->
        <aside class="sidebarRight">
            <div id="rightside-navigation ">
                <div class="sidebar-heading"><i class="fa fa-user"></i> Contacts</div>
                <div class="sidebar-title">online</div>
                <div class="list-contacts">
                    <a href="javascript:void(0)" class="list-item">
                        <div class="list-item-image">
                            <img src="/Public/assets/img/avatar.gif" class="img-circle">
                        </div>
                        <div class="list-item-content">
                            <h4>James Bagian</h4>
                            <p>Los Angeles, CA</p>
                        </div>
                        <div class="item-status item-status-online"></div>
                    </a>
                    <a href="javascript:void(0)" class="list-item">
                        <div class="list-item-image">
                            <img src="/Public/assets/img/avatar1.gif" class="img-circle">
                        </div>
                        <div class="list-item-content">
                            <h4>Jeffrey Ashby</h4>
                            <p>New York, NY</p>
                        </div>
                        <div class="item-status item-status-online"></div>
                    </a>
                    <a href="javascript:void(0)" class="list-item">
                        <div class="list-item-image">
                            <img src="/Public/assets/img/avatar2.gif" class="img-circle">
                        </div>
                        <div class="list-item-content">
                            <h4>John Douey</h4>
                            <p>Dallas, TX</p>
                        </div>
                        <div class="item-status item-status-online"></div>
                    </a>
                    <a href="javascript:void(0)" class="list-item">
                        <div class="list-item-image">
                            <img src="/Public/assets/img/avatar3.gif" class="img-circle">
                        </div>
                        <div class="list-item-content">
                            <h4>Ellen Baker</h4>
                            <p>London</p>
                        </div>
                        <div class="item-status item-status-away"></div>
                    </a>
                </div>

                <div class="sidebar-title">offline</div>
                <div class="list-contacts">
                    <a href="javascript:void(0)" class="list-item">
                        <div class="list-item-image">
                            <img src="/Public/assets/img/avatar4.gif" class="img-circle">
                        </div>
                        <div class="list-item-content">
                            <h4>Ivan Bella</h4>
                            <p>Tokyo, Japan</p>
                        </div>
                        <div class="item-status"></div>
                    </a>
                    <a href="javascript:void(0)" class="list-item">
                        <div class="list-item-image">
                            <img src="/Public/assets/img/avatar5.gif" class="img-circle">
                        </div>
                        <div class="list-item-content">
                            <h4>Gerald Carr</h4>
                            <p>Seattle, WA</p>
                        </div>
                        <div class="item-status"></div>
                    </a>
                    <a href="javascript:void(0)" class="list-item">
                        <div class="list-item-image">
                            <img src="/Public/assets/img/avatar6.gif" class="img-circle">
                        </div>
                        <div class="list-item-content">
                            <h4>Viktor Gorbatko</h4>
                            <p>Palo Alto, CA</p>
                        </div>
                        <div class="item-status"></div>
                    </a>
                </div>
            </div>
        </aside>
        <!--sidebar right end-->
    </section>
    <!--Global JS-->
    <script src="/Public/assets/js/jquery-1.10.2.min.js"></script>
    <script src="/Public/assets/plugins/bootstrap/js/bootstrap.min.js"></script>
    <script src="/Public/assets/plugins/waypoints/waypoints.min.js"></script>
    <script src="/Public/assets/plugins/nanoScroller/jquery.nanoscroller.min.js"></script>
    <script src="/Public/assets/js/application.js"></script>
    <script src="/Public/js/dialog/layer.js"></script>
    <script src="/Public/js/dialog.js"></script>
    <!--Page Leve JS -->
    <!--<script src="/Public/assets/plugins/dataTables/js/jquery.dataTables.js"></script>-->
    <!--<script src="/Public/assets/plugins/dataTables/js/dataTables.bootstrap.js"></script>-->
    <script src="/Public/js/admin/common.js" type="text/javascript" charset="utf-8"></script>
    
    <!--Load these page level functions-->
    <script>
		var SCOPE={
			'push_url':'/admin.php?c=apppush&a=push',
			'jump_url':'/admin.php?c=apppush&a=index',
			
		}
		
		function pushmsg () {
			var datas = {
				msg : $('#msg').val(),
				title:$('#title').val(),
				pushto:$('#pushto').val(), 
				time_to_live:$('#time_to_live').val(),
			}
			$.ajax({
				type:"post",
				url:SCOPE.push_url,
				async:true,
				data:datas,
				dataType:'json',
				success:function(ret){
					console.log(ret);
//					alert(typeof ret);
					if (ret.code==200) {
						return	dialog.success(ret.msg,SCOPE.jump_url);
					} else{
						return	dialog.error(ret.msg);
					}
				},
				error:function(err){
					return	dialog.error('服务器君开小差了！');
				}
			});
		}
    </script>   

</body>

</html>
